<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>密码修改-学籍管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/SSMS/Public/css/home_bootstrap.css">
    <link rel="stylesheet" href="/SSMS/Public/css/home_head.css">
    <!--[if lte IE 6]>
        <link rel="stylesheet" type="text/css" href="/SSMS/Public/css/bootstrap-ie6.min.css">
        <link rel="stylesheet" type="text/css" href="/SSMS/Public/css/ie.css">
    <![endif]-->
    <!--</header>-->
    <script type="text/javascript" src="/SSMS/Public/js/jquery-1.11.3.min.js"></script>
    <script type = "text/javascript" src ="/SSMS/Public/js/bootstrap.js"></script>
    <!--[if lte IE 6]>
        <script type="text/javascript" src="/SSMS/Public/js/bootstrap-ie.js"></script>
    <![endif]-->
    <!-- end header -->
</head>
<body>
   
    <!-- start header -->
    <nav class="navbar navbar-inverse" id="header">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="<?php echo U('home/lesson/index');?>">学籍管理系统</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                </ul>
                <ul class="nav navbar-nav navbar-left">
                    <li><a href="<?php echo U('home/student/info');?>">学生信息</a></li>
                    <li><a href="<?php echo U('home/lesson/index');?>">课程信息</a></li>
                    <li><a href="<?php echo U('home/score/index');?>">考务信息</a></li>
                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>

    <!-- end header -->
  
<!-- start page -->
<div class="container bs-docs-container">
    <div class="row">
        <!-- 左侧导航栏 start -->
        <div class="col-lg-2 col-md-2 col-sm-4">
    <div class="page-header">
        <div class="list-group">
            <?php if(($sidebar) == "student"): ?><a href="<?php echo U('home/student/info');?>" class="list-group-item" id="student_info">
                    学生信息
                </a>
                <a href="<?php echo U('home/student/set');?>" class="list-group-item" id="student_set">
                    密码修改
                </a><?php endif; ?>
            <?php if(($sidebar) == "lesson"): ?><a href="<?php echo U('home/lesson/index');?>" class="list-group-item" id="lesson_list">
                    课程表
                </a>
                <a href="<?php echo U('home/lesson/assess');?>" class="list-group-item" id="lesson_assess">
                    课程评估
                </a><?php endif; ?>
            <?php if(($sidebar) == "score"): ?><a href="<?php echo U('home/score/index');?>" class="list-group-item" id="score_list">
                    成绩信息
                </a><?php endif; ?>
        </div>
    </div>
</div>
        <!-- 左侧导航栏 end -->
        <div class="col-lg-10 col-md-10 col-sm-8">
            <div class="page-header">
                <h2 class="titleh">密码修改</h2>
            </div>
            <div class="content">
                <div class="col-lg-4 col-sm-4 col-md-4">
                    <div class="panel panel-success">
                        <div class="panel-heading">学号</div>
                        <div class="panel-body">
                            <p><?php echo ($info["std_id"]); ?></p>
                            <input type="hidden" value="<?php echo ($info["std_id"]); ?>" id="std_id_hidden">
                        </div>
                    </div>
                </div>
                <div class="col-lg-4 col-sm-4 col-md-4">
                    <div class="panel panel-info">
                        <div class="panel-heading">原始密码</div>
                        <div class="panel-body">
                            <input type="text" class="form-control" id="old_password">
                        </div>
                    </div>
                </div>
                <div class="col-lg-4 col-sm-4 col-md-4">
                    <div class="panel panel-success">
                        <div class="panel-heading">新密码</div>
                        <div class="panel-body">
                                <input type="text" class="form-control" id="new_password">
                        </div>
                    </div>
                </div>
                <div class="col-lg-2 col-sm-2 col-md-2">
                    <button type="button" class="btn btn-primary" id="sumbit_info">保存</button>
                </div>
                <div class="col-lg-4 col-sm-4 col-md-4">
                    <p id="sumbit_warning"></p>
                </div>
                <!-- end statistics -->
            </div>
        </div>
    </div>
</div>
<script>
    $("#student_set").addClass("active");
    $("#sumbit_info").click(function () {
        var std_id=$("#std_id_hidden").val();
        var old_pwd=$("#old_password").val();
        var new_pwd=$("#new_password").val();
        $("#sumbit_warning").html("");
        $("#sumbit_warning").html("");
        var tf=0;
        $.ajax({
            type: "post",
            url: "/SSMS/index.php/home/student/checkpwd",
            async: true,
            data: {
                std_id: std_id,
                pwd:old_pwd
            },
            datatype: "json",
            success: function (data) {
                if(data.status==0)
                {
                    $.ajax({
                        type: "post",
                        url: "/SSMS/index.php/home/student/update_pwd",
                        async: true,
                        data: {
                            std_id: std_id,
                            pwd:new_pwd,
                            old_pwd:old_pwd
                        },
                        datatype: "json",
                        success: function (data) {
                            var str="";
                            if(data.status==0)
                            {
                                $("#sumbit_warning").html("密码修改成功")
                            }
                            else
                            {
                                $("#sumbit_warning").html(data.info)
                                return false
                            }
                        },
                        error:function(data)
                        {
                            $("#sumbit_warning").html("网络异常，请刷新重试")
                            return false
                        }
                    });
                }
                else
                {
                    $("#sumbit_warning").html("原始密码有误，请重新输入")
                    return false;
                }
            },
            error:function(data)
            {
                $("#sumbit_warning").html("网络异常，请刷新重试")
                return false;
            }
        });
    });
</script>
<!-- start footer -->

    <div class="clear"></div>
</body>
</html>